package com.csist.service.po.basicInfoModule.impl;

import com.csist.mapper.po.basicInfoModule.EducationStatusMapper;
import com.csist.pojo.po.basicInfoModule.EducationBackground;
import com.csist.pojo.po.basicInfoModule.EducationStatus;
import com.csist.service.po.basicInfoModule.EducationBackgroundService;
import com.csist.service.po.basicInfoModule.EducationStatusService;
import com.csist.util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName EducationStatusServiceImpl
 * @Description 【自行描述】
 * @Author cn
 * @Date 2024/6/27 12:41
 * @Version 1.0
 */
public class EducationStatusServiceImpl implements EducationStatusService {

    private SqlSession sqlSession;
    private EducationStatusMapper educationStatusMapper;

    public EducationStatusServiceImpl() {
        sqlSession = SqlSessionUtil.openSession();
        educationStatusMapper = sqlSession.getMapper(EducationStatusMapper.class);
    }

    @Override
    public List<EducationStatus> findAll() {
        List<EducationStatus> list = educationStatusMapper.findAll();
        if (list != null && list.size() > 0) {
            return list;
        }
        return null;
    }

    @Override
    public EducationStatus getEducationStatusById(int id) {
        EducationStatus educationStatusById = educationStatusMapper.getEducationStatusById(id);
        if (educationStatusById != null) {
            return educationStatusById;
        }
        return null;
    }

    @Override
    public List<EducationStatus> findEducationStatusFuzzy(EducationStatus educationStatus) {
        List<EducationStatus> list = educationStatusMapper.findEducationStatusFuzzy(educationStatus);
        if (list != null && list.size() > 0) {
            return list;
        }
        return null;
    }

    @Override
    public List<EducationStatus> findEducationStatus(EducationStatus educationStatus) {
        List<EducationStatus> list = educationStatusMapper.findEducationStatus(educationStatus);
        if (list != null && list.size() > 0) {
            return list;
        }
        return null;
    }

    @Override
    public int addEducationStatus(EducationStatus educationStatus) {
        int i = educationStatusMapper.addEducationStatus(educationStatus);
        if (i > 0) {
            sqlSession.commit();
            return i;
        }
        return 0;
    }


    @Override
    public int updateEducationStatus(EducationStatus educationStatus) {
        int i = educationStatusMapper.updateEducationStatus(educationStatus);
        if (i > 0) {
            sqlSession.commit();
            return i;
        }
        return 0;
    }

    @Override
    public int updateEducationStatusStatus(int esId) {
        int i = educationStatusMapper.updateEducationStatusStatus(esId);
        if (i > 0) {
            sqlSession.commit();
            return i;
        }
        return 0;
    }

    @Override
    public int deleteEducationStatus(int esId) {
        return 0;
    }


}
